Factor Graph
VS DGM & UGM
DGM and UGM: allow a global function of several variables to be expressed as a product of factors over subsets of those variables, designed for conditional independence or potentials.
Factor graphs: make this decomposition explicit by introducing additional nodes for the factors in addition to the nodes representing the variables, designed for more explicit details of the factorization.
Definition

$p(x_1,…,x_n)=\prod_sf_s(x_s)\qquad x_s\in\{x_1,…,x_n\}$
Each $f_s$ is a function of a set of $x_s$.
Convert a UGM into a factor graph
Representing the potential functions over cliques as factors $f_s(x_s)$.
Different factor graphs may correspond to the same DGM/UGM.
Loopy DGM/UGM becomes a tree when converted to factor graph.
Goal: compute all singleton marginal probabilities.
Messages
From variable to factor:
and $v_{is}=1$ when $x_i$ is a leaf.
From factor to variable:
and $\mu_{si}=f_s$ when $f_s$ is a leaf.
This message is equal to $m_{ji}$ in UGM.
Therefore, we can get the marginalization probability:
since $v_{is} = \prod_{t\in N(i)-s}\mu_{ti}$
Sum-product algorithm of factor graph
